using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using NetworkPower.Data.Models.Mapping;

namespace NetworkPower.Data.Models
{
    public partial class NetworkPowerContext : DbContext
    {
        static NetworkPowerContext()
        {
            Database.SetInitializer<NetworkPowerContext>(new DropCreateDatabaseIfModelChanges<NetworkPowerContext>());
        }

        public NetworkPowerContext()
            : base("Name=NetworkPowerContext")
        {
        }

        public DbSet<Equipment> Equipments { get; set; }
        public DbSet<Project> Projects { get; set; }
        public DbSet<Seperation> Seperations { get; set; }
        public DbSet<User> Users { get; set; }
        public DbSet<Voltage> Voltages { get; set; }
        public DbSet<LoopLine> LoopLines { get; set; } //a row of one sheet
        public DbSet<Department> Departments { get; set; }// a sheet of on .xls file
        public DbSet<LineProtectBox> LineProtectBoxs { get; set; } //.xls files
        public DbSet<CableLine> CableLines { get; set; }
        public DbSet<CableInventory> CableInventorys { get; set; }
        public DbSet<EquipmentNumber> EquipmentNumbers { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new EquipmentMap());
            modelBuilder.Configurations.Add(new ProjectMap());
            modelBuilder.Configurations.Add(new SeperationMap());
            modelBuilder.Configurations.Add(new UserMap());
            modelBuilder.Configurations.Add(new VoltageMap());
            modelBuilder.Configurations.Add(new LoopLineMap());
            modelBuilder.Configurations.Add(new DepartmentMap());
            modelBuilder.Configurations.Add(new LineProtectBoxMap());
            modelBuilder.Configurations.Add(new CableLineMap());
            modelBuilder.Configurations.Add(new CableInventoryMap());
            modelBuilder.Configurations.Add(new EquipmentNumberMap());
        }
    }
}
